//package cn.lili.common.swagger;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.*;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spi.service.contexts.SecurityContext;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.Collections;
//import java.util.HashSet;
//
//@Configuration
//@EnableSwagger2
//public class SwaggerConfig2 {
//    /**
//     * SpringBoot默认已经将classpath:/META-INF/resources/和classpath:/META-INF/resources/webjars/映射
//     * 所以该方法不需要重写，如果在SpringMVC中，可能需要重写定义（我没有尝试）
//     * 重写该方法需要 extends WebMvcConfigurerAdapter
//     */
////    @Override
////    public void addResourceHandlers(ResourceHandlerRegistry registry) {
////        registry.addResourceHandler("swagger-ui.html")
////                .addResourceLocations("classpath:/META-INF/resources/");
////
////        registry.addResourceHandler("/webjars/**")
////                .addResourceLocations("classpath:/META-INF/resources/webjars/");
////    }
////    @Bean
////    public Docket createRestApi() {
////        return new Docket(DocumentationType.SWAGGER_2)
////                .apiInfo(apiInfo())
////                .select()
////                .apis(RequestHandlerSelectors.basePackage("cn.lili"))
////                .paths(PathSelectors.any())
////                .build();
////    }
////
////    private ApiInfo apiInfo() {
////        return new ApiInfoBuilder()
////                .title("Spring Boot中使用Swagger2构建RESTful APIs")
////                .description("rest api 文档构建利器")
////                .termsOfServiceUrl("https://blog.wuwii.com/")
////                .contact("KronChan")
////                .version("1.0")
////                .build();
////    }
//
//	@Bean
//	public Docket apiDocket() {
//		HashSet<String> contentType = new HashSet<>();
//		contentType.add("application/json");
//		return new Docket(DocumentationType.SWAGGER_2)
//				.produces(contentType) //Or whatever default value(s)
//				.consumes(contentType)
//				.select()
//				.apis(RequestHandlerSelectors.basePackage("cn.lili"))
//				.paths(PathSelectors.any())
//				.build()
//				.apiInfo(metadata())
//				.securitySchemes(Collections.singletonList(new ApiKey("JWT", "Authorization", "header")))
//				.securityContexts(
//						Collections.singletonList(
//								SecurityContext.builder().securityReferences(
//										Collections.singletonList(SecurityReference.builder().reference("JWT").scopes(new AuthorizationScope[0]).build())
//								).build()
//						)
//				);
//	}
//
//	private ApiInfo metadata() {
//		return new ApiInfoBuilder()
//				.title("manager-api")
//				.description("manager-api desc")
//				.version("v1.0")
//				.contact(new Contact(null, null, null))
//				.build();
//	}
//}
